package com.qixiucoding.util;

import com.alibaba.fastjson.JSONArray;
import com.qixiucoding.pojo.ParsingRulesEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.regex.Pattern;

/**
 * @Description TODO
 * @Author longhj
 * @Date 2021/11/24 星期三 23:20
 */
@Slf4j
public class TableResolve {
    /**
     *
     * @param jsonArray 传入数据
     * @param rulesList 传入的匹配规则
     * @param gradeMap 等级的记录，可用于等级的输出
     * @return
     */
    public static Map<String, String> resolveHorizontalTable(JSONArray jsonArray, List<ParsingRulesEntity> rulesList, Map<String, Integer> gradeMap) {
        //结果Map
        Map<String, String> resultMap = new HashMap<>();
        if (ObjectUtils.isEmpty(jsonArray) && jsonArray.size() == 0) {
            log.warn("TableResolve-resolveHorizontalTable:传入的数据为空，方法返回空Map！！！");
            return resultMap;

        }
        if (ObjectUtils.isEmpty(rulesList) && rulesList.size() == 0) {
            log.warn("TableResolve-resolveHorizontalTable:传入的匹配规则为空，方法返回空Map！！！");
            return resultMap;
        }
        if (ObjectUtils.isEmpty(gradeMap)){
            log.warn("TableResolve-resolveHorizontalTable:未传入记录等级Map");
            gradeMap = new HashMap<String,Integer>();
        }
        return resultMap;

    }
}
